import { createRouter, createWebHashHistory } from 'vue-router'


const HOME = () => import(/* webpackChunkName: "home" */ '../views/Home.vue')
const CART = () => import(/* webpackChunkName: "cart" */ '../views/cart/index.vue')
const GOODS = () => import(/* webpackChunkName: "goods" */ '../views/goods/index.vue')
const USER = () => import(/* webpackChunkName: "user" */ '../views/user/index.vue')
const FRIENDS = () => import(/* webpackChunkName: "friend" */ '../views/friends/index.vue')
const DETAIL = () => import(/* webpackChunkName: "friend" */ '../views/detail/index.vue')
const LOGIN = () => import(/* webpackChunkName: "friend" */ '../views/login/index.vue')
const SEARCH = () => import(/* webpackChunkName: "friend" */ '../views/search/index.vue')
const CATEGORY = () => import(/* webpackChunkName: "friend" */ '../views/category/index.vue')


const router = createRouter({
  history: createWebHashHistory(), // hash模式：createWebHashHistory，history模式：createWebHistory
  routes: [
    { path: '/',redirect: '/home'},
    { path: '/home', name: 'home', component: HOME, meta: {   index: 1 }, children: [   {     path: 'aaa',     component: () => import(/* webpackChunkName: "home" */ '../views/goods/index.vue'),}]},
    { path: '/cart', name: 'cart', component: CART, meta: {   index: 2 }},
    { path: '/goods', name: 'goods', component: GOODS, meta: {   index: 3 }},
    { path: '/user', name: 'user', component: USER, meta: {   index: 4 }},      
    { path: '/friends', name: 'friends', component: FRIENDS, meta: {   index: 5 }},
    { path: '/login', name: 'login', component: LOGIN, meta: {   index: 6 }},
    { path: '/detail/:id', name: 'detail', component: DETAIL, meta: {   index: 7 }} , // 详情页
    { path: '/search', name: 'search', component: SEARCH, meta: {   index: 8 }} , // 详情页
    { path: '/category', name: 'category', component: CATEGORY, meta: {   index: 9 }} , // 分类

    // },
    // {
    //   path: '/login',
    //   name: 'login',
    //   component: () => import(/* webpackChunkName: "login" */ '@/views/Login.vue'),
    //   meta: {
    //     index: 1
    //   }
    // },
    // {
    //   path: '/about',
    //   name: 'about',
    //   component: () => import(/* webpackChunkName: "about" */ '@/views/About.vue'),
    //   meta: {
    //     index: 2
    //   }
    // },
    // {
    //   path: '/category',
    //   name: 'category',
    //   component: () => import(/* webpackChunkName: "category" */ '@/views/Category.vue'),
    //   meta: {
    //     index: 1
    //   }
    // },
    // {
    //   path: '/product-list',
    //   name: 'product-list',
    //   component: () => import(/* webpackChunkName: "product-list" */ '@/views/ProductList.vue'),
    //   meta: {
    //     index: 2
    //   }
    // },
    // {
    //   path: '/product/:id',
    //   name: 'product',
    //   component: () => import(/* webpackChunkName: "product" */ '@/views/ProductDetail.vue'),
    //   meta: {
    //     index: 3
    //   }
    // },
    // {
    //   path: '/cart',
    //   name: 'cart',
    //   component: () => import(/* webpackChunkName: "cart" */ '@/views/Cart.vue'),
    //   meta: {
    //     index: 1
    //   }
    // },
    // {
    //   path: '/create-order',
    //   name: 'create-order',
    //   component: () => import(/* webpackChunkName: "create-order" */ '@/views/CreateOrder.vue'),
    //   meta: {
    //     index: 2
    //   }
    // },
    // {
    //   path: '/order',
    //   name: 'order',
    //   component: () => import(/* webpackChunkName: "order" */ '@/views/Order.vue'),
    //   meta: {
    //     index: 2
    //   }
    // },
    // {
    //   path: '/order-detail',
    //   name: 'order-detail',
    //   component: () => import(/* webpackChunkName: "order-detail" */ '@/views/OrderDetail.vue'),
    //   meta: {
    //     index: 3
    //   }
    // },
    // {
    //   path: '/user',
    //   name: 'user',
    //   component: () => import(/* webpackChunkName: "user" */ '@/views/User.vue'),
    //   meta: {
    //     index: 1
    //   }
    // },
    // {
    //   path: '/setting',
    //   name: 'setting',
    //   component: () => import(/* webpackChunkName: "setting" */ '@/views/Setting.vue'),
    //   meta: {
    //     index: 2
    //   }
    // },
    // {
    //   path: '/address',
    //   name: 'address',
    //   component: () => import(/* webpackChunkName: "address" */ '@/views/Address.vue'),
    //   meta: {
    //     index: 2
    //   }
    // },
    // {
    //   path: '/address-edit',
    //   name: 'address-edit',
    //   component: () => import(/* webpackChunkName: "address-edit" */ '@/views/AddressEdit.vue'),
    //   meta: {
    //     index: 3
    //   }
  ]
})

export default router